//package com.jiezuo.common.util;
//
//import com.google.zxing.BarcodeFormat;
//import com.google.zxing.EncodeHintType;
//import com.google.zxing.WriterException;
//import com.google.zxing.client.j2se.MatrixToImageWriter;
//import com.google.zxing.common.BitMatrix;
//import com.google.zxing.qrcode.QRCodeWriter;
//import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
//import lombok.extern.slf4j.Slf4j;
//
//import java.io.File;
//import java.io.IOException;
//import java.nio.file.FileSystems;
//import java.nio.file.Path;
//import java.util.Hashtable;
//
///**
// * @Author: 庞留杰
// * @Date: 2022-06-07 10:40
// * @Description: *
// */
//@Slf4j
//public class QRCodeUtils {
//    private static final int WIDTH =72;
//    private static final int HEIGHT =72;
//    public static String generateQRCodeImage(String text,String reportPassword,String filePath){
//        QRCodeWriter qrCodeWriter =new QRCodeWriter();
//        Hashtable hints =new Hashtable();
//        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
//        hints.put(EncodeHintType.CHARACTER_SET,"utf-8");
//        hints.put(EncodeHintType.MARGIN,1);
//        BitMatrix bitMatrix = null;
//        try {
//            bitMatrix = qrCodeWriter.encode(DESUtil.encrypt(text,reportPassword), BarcodeFormat.QR_CODE, WIDTH, HEIGHT,hints);
//        } catch (WriterException e) {
//            log.error("=========二维码生成出错=======");
//            e.printStackTrace();
//        }
//        File file=new File(filePath);
//        if (!file.exists()){
//            file.mkdirs();
//        }
//        String fileName=text.split("-")[0]+".JPEG";
//        Path path = FileSystems.getDefault().getPath(filePath+fileName);
//        try {
//            MatrixToImageWriter.writeToPath(bitMatrix,"JPEG", path);
//        } catch (IOException e) {
//            log.error("=========二维码输出出错=======");
//            e.printStackTrace();
//        }
//        return filePath+fileName;
//    }
//    public static void main(String[] args){
//        //generateQRCodeImage("JC2022","C:\\Users\\LDF\\Desktop\\");
//    }
//}
